<script src="https://unpkg.com/vue@next"></script>

<p>使用vue3</p>
<p>Vue3 中得，h已经单独提取为出来，并且将参数扁平化，不必再传递参数</p>
<div id="app">
  <div>{{ message }}</div>
</div>

<script>
  const h = Vue.h;
  const app = Vue.createApp({
    data() {
      return {
        message: " hello createElement()"
      }
    },
    render() {
      return h("div", {
        id: "foo",
        onClick: this.clickDom,
        text: "inner text"
      }, [
        h("span", "children-1"),
        h("div", {
          class: "children-2",
        }, "children-2"),
        createVdom()
      ])
    },
    methods: {
      clickDom() {
        console.log("click dom");
      }
    },
  }).mount("#app");

  function createVdom() {
    return h("div", "children-3");
  }
</script>